<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //flat 平
        //将多维数组转换为低维数组
        // const arr = [1,2,3,4,[5,6]]
        // console.log(arr.flat());//[1,2,3,4,5,6]将二维转换成一维

        // const arr = [1,2,3,4,[5,6,[7,8,9]]]
        // console.log(arr.flat());//[1,2,3,4,5,6,[7,8,9]]

        //const arr = [1,2,3,4,[5,6,[7,8,9]]]
        //参数为深度 是一个数字 2表示两层 3表示三层 默认为1
        //console.log(arr.flat(2));

        //flatMap
        const arr = [1,2,3,4]
        const result = arr.flatMap(item => [item * 10])
        console.log(result);//返回的是一个二维数组
    </script>
</body>
</html>